<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:ic="http://ivyteam.ch/jsf/component"
	xmlns:p="http://primefaces.org/ui"
	xmlns:c="http://java.sun.com/jsp/jstl/core">

<h:head>
	<script type="text/javascript" src="rest/ivyajaxapi.js"></script>
</h:head>
<h:body>
	<ui:composition
		template="../template/basicTemplate/basicTemplate.xhtml">
		<ui:define name="title">
        Confirm Form
    	</ui:define>
		<ui:define name="header">
        Confirmation
    	</ui:define>
		<ui:define name="center">
			<h:form id="confirmForm">
				<h:panelGroup>
					<h:panelGrid columns="2" cellpadding="4">
						<p:outputLabel
							value="#{ivy.cms.co('/ch/ivy/demo/label/firstName')}"
							for="firstname" />
						<p:inplace id="infirstname" saveLabel="true">
							<p:inputText value="#{data.userInfo.firstName}" id="firstname"
								required="true"
								requiredMessage="#{ivy.cms.co('/ch/ivy/demo/error/required')}" />
						</p:inplace>
						<span></span>
						<p:message for="firstname" />
						<p:outputLabel
							value="#{ivy.cms.co('/ch/ivy/demo/label/LastName')}"
							for="lastname" />
						<p:inplace id="inlastname" saveLabel="true">
							<p:inputText value="#{data.userInfo.firstName}" id="lastname"
								required="true"
								requiredMessage="#{ivy.cms.co('/ch/ivy/demo/error/required')}" />
						</p:inplace>
						<span></span>
						<p:message for="lastname" />
						<p:outputLabel
							value="#{ivy.cms.co('/ch/ivy/demo/label/username')}" />
						<p:outputLabel value="#{data.userInfo.userName}"></p:outputLabel>
						<p:outputLabel
							value="#{ivy.cms.co('/ch/ivy/demo/label/birthdate')}" />
						<p:outputLabel value="#{data.userInfo.birthdate}"></p:outputLabel>
						<p:outputLabel value="#{ivy.cms.co('/ch/ivy/demo/label/email')}" />
						<p:outputLabel value="#{data.userInfo.email}"></p:outputLabel>
						<p:outputLabel value="#{ivy.cms.co('/ch/ivy/demo/label/phone')}" />
						<p:outputLabel value="#{data.userInfo.phone}"></p:outputLabel>
						<p:outputLabel value="#{ivy.cms.co('/ch/ivy/demo/label/country')}" />
						<p:outputLabel value="#{data.userInfo.country}"></p:outputLabel>
						<p:outputLabel value="#{ivy.cms.co('/ch/ivy/demo/label/dep')}" />
						<p:outputLabel value="#{data.userInfo.department}"></p:outputLabel>
						<p:outputLabel value="#{ivy.cms.co('/ch/ivy/demo/label/Sex')}" />
						<c:if test="#{data.userInfo.sex == '0'}">
							<p:outputLabel value="#{ivy.cms.co('/ch/ivy/demo/label/Female')}" />
						</c:if>
						<c:if test="#{data.userInfo.sex == '1'}">
							<p:outputLabel value="#{ivy.cms.co('/ch/ivy/demo/label/Male')}" />
						</c:if>
					</h:panelGrid>
					<h:panelGrid columns="2" cellpadding="4">
					</h:panelGrid>
				</h:panelGroup>

				<p:commandButton id="btnBack" actionListener="#{logic.back}"
					value="#{ivy.cms.co('/ch/ivy/demo/label/btnBack')}" process="@none"></p:commandButton>
				<p:commandButton id="btnCancel" actionListener="#{logic.cancel}"
					value="#{ivy.cms.co('/ch/ivy/demo/label/cancel')}" process="@none"></p:commandButton>
				<p:commandButton id="btnRegist" actionListener="#{logic.regist}"
					value="#{ivy.cms.co('/ch/ivy/demo/label/register')}"
					update="confirmForm"
					oncomplete="handleLoginRequest(xhr, status, args)"></p:commandButton>
			</h:form>
			<p:dialog id="dialogMsg" header="Message" widgetVar="dlg" draggable="false" resizable="false" dynamic="true" closable="false" model="true" showEffect="puff" hideEffect="fade">
				<h:form>
					<h:outputLabel
						value="#{ivy.cms.co('/ch/ivy/demo/label/loginSucess')}" />
					<br />
					<p:commandButton id="btnOK"
						value="#{ivy.cms.co('/ch/ivy/demo/label/OK')}"
						actionListener="#{logic.login}" style="float: right;" onclick="dlg.hide()"/>
				</h:form>
			</p:dialog>

			<script type="text/javascript">
				function handleLoginRequest(xhr, status, args) {
					if (args.successfull) {
						dlg.show();
					}
				}
			</script>
		</ui:define>
	</ui:composition>
</h:body>
</html>